<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
	<title>云文档————修改昵称</title>
	<style>
		@media only screen and (min-width:1024px){
		*{
			margin: 0;
			padding: 0;
		}
		body{
			width: 100vw;
			height: 100vh;
			background: url("https://api.oick.cn/random/api.php");
			background-size: cover;
			background-attachment: fixed;
			text-align: center;
			}
			.zt{
				width: 50vw;
				height: 500px;
				background:white;
				opacity: 0.7;
				margin: auto;
				margin-top: 10vh;
				border-radius: 15px;
			}
			.zt:hover{
				width: 50vw;
				height: 500px;
				background:white;
				opacity: 1;
				margin: auto;
				margin-top: 10vh;
				border-radius: 15px;
				transition: 0.5s;
			}
			.nr{
				width: 45vw;
				height:15vh;
				background: lightblue;
				margin-top: 5vh;
				font-size: 9vh;
				border-radius: 15px;
				border:none;
			}
			.an{
				width: 40vw;
				height: 13vh;
				background: indianred;
				margin: auto;
				margin-top: 7vh;
				font-size: 10vh;
				border-radius: 15px;
			}
			}
			@media only screen and (max-width:1024px){
				*{
					margin: 0;
					padding: 0;
				}
				body{
					width: 100vw;
					height: 100vh;
					background: url("https://api.oick.cn/random/api.php");
					background-size: cover;
					background-attachment: fixed;
					text-align: center;
				}
				.zt{
					width: 80vw;
					height: 50vh;
					background: white;
					opacity: 0.7;
					margin: auto;
					margin-top: 10vh;
					border-radius: 25px;
				}
				.zt:hover{
					width: 80vw;
					height: 50vh;
					background: white;
					opacity: 1;
					margin: auto;
					margin-top: 10vh;
					border-radius: 25px;
					transition: 0.5s;
				}
				.nr{
					width: 70vw;
					height: 10vh;
					margin-top: 10vh;
					background: coral;
					border-radius: 15px;
					font-size: 30px;
					border:none;
				}
				.an{
					width: 60vw;
					height:8vh;
					background: cornflowerblue;
					margin: auto;
					margin-top: 5vh;
					border-radius: 10px;
					font-size: 30px;
					line-height: 60px;
				}
			}
	</style>
</head>
<body>
	<div class="zt" onload="getzhmm()">
		<input type="text" class="nr" placeholder="请输入修改昵称" id="nc">
		<div class="an" onclick="xg()">确定</div>
		<div class="an" onclick="window.history.back()">返回</div>
	</div>
</body>
</html>
<script type="text/javascript">
    function xg(){
        var user=$.cookie('user');
        var pass=$.cookie('pass');
        var xnc=document.getElementById('nc').value;
        if(user=='' || pass=='' || xnc==''){
            alert("参数不完整");
        }else{
            $.post("xgnc.php",{
                user:user,
                pass:pass,
                new:xnc
            },
            function (data){
            	if(data=="昵称修改成功"){
                alert(data);
        }
    }
            );
        }
    }
        function getzhmm(){
        var zh=$.cookie('user');
        var mm=$.cookie('pass');
        $.post("denglu.php",{
            user:zh,
            pass:mm
        },
        function (data){
            if(data.msg=="登录成功"){
        }else{
            alert("身份验证失败，请重新登录");
            window.location.href='login.php';
        }
    },"json");
    }
</script>